package com.travelSpring.controller;

import com.travelSpring.common.Result;
import com.travelSpring.entity.User;
import com.travelSpring.service.UserService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 功能：
 * 作者：卷心菜
 * 日期：2025/2/25 18:36
 */
@RestController
public class WebController {

    @Resource
    UserService userService;

    @PostMapping("/login")
    public Result login(@RequestBody User user) {
        User dbUser = userService.login(user);
        return Result.success(dbUser);
    }

    @PostMapping("/register")
    public Result register(@RequestBody User user) {
        userService.register(user);
        return Result.success();
    }
}
